package com.txzt.gaea.provide.controller;

import com.txzt.base.core.RtnInfo;
import com.txzt.gaea.api.client.AdminUserRemoteService;
import com.txzt.gaea.dto.UserMenuByToolCodeDTO;
import com.txzt.gaea.vo.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 文件服务器对接gaea门户部分用户，菜单接口
 */
@Validated
@RestController
@RequestMapping("/role")
public class RoleController {

    @Value("${tool.code}")
    String toolCode;

    @Autowired
    private AdminUserRemoteService adminUserRemoteService;


    /**
     * 从门户获取角色信息
     *
     * @param dto
     * @return
     * @throws Exception
     */
    @PostMapping("/list/query/remote")
    public RtnInfo<List<RoleVO>> query(@RequestBody UserMenuByToolCodeDTO dto) throws Exception {
        dto.setToolCode(toolCode);
        return adminUserRemoteService.menuQueryByToolCode(dto);
    }
}
